WinMac32 Delphi Macro Component and DLL Set for Windows. Copyright (c) 1994-1996 Ken Henderson. Here's the 32-bit version of the Winmacro component set and macro engine that I originally released for Delphi 1.0. Winmacro 1.x users will remember the TMacroSet component -- it implements a full-blown macro engine for Windows. The unit actually defines two other components, as well, TMacroKeyEdit (a desecendant of TEdit that allows entry of hot keys rather than text) and TMacroComboBox (a descendant of TComboBox that allows selection from a list of all available keys). The component set provides much of the functionality of the Windows 3.x Recorder accessory, but far exceeds it in many ways. One of the most significant ways it does this is in its support for "code" macros -- macros that execute callback routines rather than playback keystrokes. It also allows nearly any key on the keyboard to be a hotkey -- it even allows mouse buttons to serve in that capacity. And, best of all, it's all configurable from a simple component that insulates the developer from the complexities, pitfalls and near-death-experiences of the Windows journaling facility. Another set of facilities in which you may have an interest is TMacroSet's SendKeys and AppActivate routines. These work similarly to their Visual Basic counterparts. AppActivate makes a named window the current input focus, while SendKeys sends simulated keyboard input to the current input focus. Note that, unlike the 16-bit version of Winmacro, the SendKeys routine in WinMac32 does not require that the macro engine be initialized before it can be used. Also, the version of SendKeys found in WinMac32 supports a second parameter, "Wait" -- a boolean switch that determines whether the routine waits for the current input focus to process each simulated keystroke before sending it another. I won't go into all the features -- the comments in the WinMac32 source code document them well. There's also a wealth of info on the internals of the engine and components that you may find interesting. The source to the components are in WMacro.pas, the source to the macro engine DLL is in WinMac32.pas. You'll want to check out the included SRecordR (SuperRecorder) program for a demo of some of the things you can do with the macro facility. I've written the engine in such a way as to make it language independent. I'll be releasing the header files required to use it with C/C++ very soon. Delphi Installation 1) Unzip WinMac32.zip to the directory in which you'd like it to reside. Either add this directory to your path or copy WinMac32.dll to a directory that is on your path (e.g., \WINDOWS, \PROGRAM FILES\BORLAND\DELPHI 2.0\BIN, etc.) 2) Select the Install item from the Delphi 2.0 Component menu. Click the Add button and supply the full path to the WMACRO.PAS file that was created when you unzipped WinMac32.zip. 3) A new toolbar page called "Macros" is created that contains the three components comprising Delphi's interface to WinMac32.dll. Special note for running SuperRecorder from under Delphi You'll want to uncheck "Break on exception" in the Tools|Options|Environment dialog when running SuperRecorder under Delphi. SuperRecorder enters a loop that iterates through all the *possible* macro indexes and obtains the name and hot key for each as it goes. Since macros can be deleted from the middle of the macros "array" -- the engine does not provide a method for returning the number of currently allocated macros -- it would be of very limited use. Since there is no method of this type available, programs wishing to list all available macros must loop through the macro list beginning with index 0 through the maximum number of macros. Though the maximum number of macros that you may allocate is limited only by available memory, TMacroSet surfaces a property, MaxMacroNum, to assist in building macros lists. Applications that use MaxMacroNum must handle exceptions generated by attempting to access a macro that has been deactivated or by referring to an index that has not yet had a macro assigned to it. SuperRecorder demonstrates how to do this. Limits on use This version of Winmacro has been released as a Shareware product. WinMac32 comes in two flavors: the trial version and the full version. The trial version will only run when Delphi is also running. If you attempt to run an application that uses TMacroSet or WinMac32 while Delphi 2.0 is not also running, the DLL will refuse to load and you application will crash. The full version, on the other hand, functions properly regardless of whether Delphi is also running. It also includes the complete source code to WinMac32, as well as the 16-bit version of the product for use with Delphi 1.0. You can obtain the full version by registering. Since the trial version of the product is for trying it out only, you can't include it with other applications. You must register the product if you intend to use it. To register, send a check or money order for $45 (in US dollars) to: Ken Henderson P. O. Box 721368 Oklahoma City, OK 73172-1368 Once registered, you'll receive: * the complete source code to WinMac32 * the source code to SendKeys and AppActivate, which can be used independently of the macro engine * the full, non-crippled version of the product * the 16-bit version of the product for use with Delphi 1.0 * documentation that explains the use of the product * notification of future updates and upgrades Note that the source code to SendKeys and AppActivate can also be found on the CD-ROM that accompanies my book, Database Developer's Guide with Delphi 2.0, available from SAMS Publishing. You can include the full version of WinMac32 with the applications you write without royalties or other obigations to me. The only restriction on this is that you may not include WinMac32 with a programming library of any type without my express written permission. You can feel free to upload the trial version of WinMac32 to other on-line forums and ftp sites so long as you do not modify it in any way (this includes adding or removing files from its ZIP file archive). I'd appreciate any feedback you might have. Send any comments or suggestions to (CIS): 74763,2305 (Internet: 74763,2305@compuserve.com). Many thanks to Danny Thorpe of Borland for his help and suggestions. Ken Henderson March 25, 1996